home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / Source / Chapter 9 / Engine / RenderCache.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-07-20  |  1.5 KB  |  47 lines

  1. //-----------------------------------------------------------------------------
  2. // File: RenderCache.h
  3. //
  4. // Version: 1.0
  5. //
  6. // Description: Manages the rendering of indexed faces from a set of vertices.
  7. //
  8. // Change History
  9. // ~~~~~~~~~~~~~~
  10. // v1.0 (17/02/04) - Inception.
  11. //
  12. // Copyright (c) 2004 Vaughan Young
  13. //-----------------------------------------------------------------------------
  14. #ifndef RENDER_CACHE_H
  15. #define RENDER_CACHE_H
  16.  
  17. //-----------------------------------------------------------------------------
  18. // Render Cache Class
  19. //-----------------------------------------------------------------------------
  20. class RenderCache
  21. {
  22. public:
  23.     RenderCache( IDirect3DDevice9 *device, Material *material );
  24.     virtual ~RenderCache();
  25.  
  26.     void AddFace();
  27.     void Prepare( unsigned long totalVertices );
  28.  
  29.     void Begin();
  30.     void RenderFace( unsigned short vertex0, unsigned short vertex1, unsigned short vertex2 );
  31.     void End();
  32.  
  33.     Material *GetMaterial();
  34.  
  35. private:
  36.     IDirect3DDevice9 *m_device; // Pointer to a Direct3D device.
  37.     Material *m_material; // Pointer to the material used by this render cache.
  38.  
  39.     IDirect3DIndexBuffer9 *m_indexBuffer; // Index buffer pointing to the vertices to render.
  40.     unsigned short *m_indexPointer; // Pointer for accessing the index buffer.
  41.     unsigned long m_totalIndices; // Total number of indices this render cache can handle.
  42.     unsigned long m_faces; // Total number of faces to be rendered.
  43.  
  44.     unsigned long m_totalVertices; // Total number of vertices.
  45. };
  46.  
  47. #endif